<?php
	include_once "util/my_db.php";
	
	$products_pic_path = Array();
	$products_id = Array();
	$products_column = Array();
	$products_title = Array();
	$i=0;
	
	$sql="select nn.id,nn.title,nn.pic_path,nc.id as column_id from news_news nn,news_column_news ncn,news_column nc where ncn.news_id=nn.id and ncn.column_id=nc.id and nc.parent_id=20 and nc.id=21 order by nn.counter desc";
	$result = $dbObject->query_range($sql,0,5);
	while ($row = mysql_fetch_array($result)) {
		$products_id1[$i] = $row["id"];
		$products_column1[$i] = $row["column_id"];
		$products_title1[$i] = $row["title"];
		$products_pic_path1[$i] = $row["pic_path"];
		$i++;
	}
	
	$i=0;
	$sql="select nn.id,nn.title,nn.pic_path,nc.id as column_id from news_news nn,news_column_news ncn,news_column nc where ncn.news_id=nn.id and ncn.column_id=nc.id and nc.parent_id=20 and nc.id=22 order by nn.counter desc";
	$result = $dbObject->query_range($sql,0,5);
	while ($row = mysql_fetch_array($result)) {
		$products_id2[$i] = $row["id"];
		$products_column2[$i] = $row["column_id"];
		$products_title2[$i] = $row["title"];
		$products_pic_path2[$i] = $row["pic_path"];
		$i++;
	}
	
	$i=0;
	$sql="select nn.id,nn.title,nn.pic_path,nc.id as column_id from news_news nn,news_column_news ncn,news_column nc where ncn.news_id=nn.id and ncn.column_id=nc.id and nc.parent_id=20 and nc.id=23 order by nn.counter desc";
	$result = $dbObject->query_range($sql,0,5);
	while ($row = mysql_fetch_array($result)) {
		$products_id3[$i] = $row["id"];
		$products_column3[$i] = $row["column_id"];
		$products_title3[$i] = $row["title"];
		$products_pic_path3[$i] = $row["pic_path"];
		$i++;
	}
	$i=0;
	$sql="select nn.id,nn.title,nn.pic_path,nc.id as column_id from news_news nn,news_column_news ncn,news_column nc where ncn.news_id=nn.id and ncn.column_id=nc.id and nc.parent_id=20 and nc.id=24 order by nn.counter desc";
	$result = $dbObject->query_range($sql,0,5);
	while ($row = mysql_fetch_array($result)) {
		$products_id4[$i] = $row["id"];
		$products_column4[$i] = $row["column_id"];
		$products_title4[$i] = $row["title"];
		$products_pic_path4[$i] = $row["pic_path"];
		$i++;
	}
	$i=0;
	$sql="select nn.id,nn.title,nn.pic_path,nc.id as column_id from news_news nn,news_column_news ncn,news_column nc where ncn.news_id=nn.id and ncn.column_id=nc.id and nc.parent_id=20 and nc.id=25 order by nn.counter desc";
	$result = $dbObject->query_range($sql,0,5);
	while ($row = mysql_fetch_array($result)) {
		$products_id5[$i] = $row["id"];
		$products_column5[$i] = $row["column_id"];
		$products_title5[$i] = $row["title"];
		$products_pic_path5[$i] = $row["pic_path"];
		$i++;
	}
?>
<?
	function showPic($id,$column_id,$title,$pic_path){
		$str="<p class='thumbs'><a href='#' onClick=\"showBigPic('". showFullPic($id,$column_id,$title,$pic_path) ."')\" title='". $title ."' class='thumbs'><img src='". $pic_path ."' width='75' height='75' /></a></p>";
		return $str;
	}
	
	function showFullPic($id,$column_id,$title,$pic_path){
		$str="<a href=news_list_en.php?news_id=". $id ."&column_id=".$column_id."><img src=". $pic_path ." border=0/></a>";
		return $str;
	}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>MerrySon The Pet Shop</title>
<LINK href="css/petshop.css" type=text/css rel=stylesheet>
<script>
 function showBigPic(html_str){
	document.getElementById("big_pic").innerHTML=html_str; 
 }
</script>
</head>
<body bgcolor="#EDEEEF">
<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">
	<tr>
		<td width="300" align="center" valign="middle" bgcolor="#FFFFFF"><div id="big_pic"><? if(count($products_id1)>0) echo showFullPic($products_id1[0],$products_column1[0],$products_title1[0],$products_pic_path1[0]); else echo "&nbsp;";  ?></div></td>
		<td width="5" bgcolor="#EDEEEF">&nbsp;</td>
	  <td bgcolor="#D3D6D6"><table width="460" height="480" border="0" cellspacing="5" cellpadding="0">
				<tr>
					<td width="87" height="87"><? if(count($products_id1)>0) echo showPic($products_id1[0],$products_column1[0],$products_title1[0],$products_pic_path1[0]); else echo "&nbsp;"; ?></td>
					<td width="87"><? if(count($products_id1)>1) echo showPic($products_id1[1],$products_column1[1],$products_title1[1],$products_pic_path1[1]); else echo "&nbsp;"; ?></td>
					<td width="87"><? if(count($products_id1)>2) echo showPic($products_id1[2],$products_column1[2],$products_title1[2],$products_pic_path1[2]); else echo "&nbsp;"; ?></td>
					<td width="87"><? if(count($products_id1)>3) echo showPic($products_id1[3],$products_column1[3],$products_title1[3],$products_pic_path1[3]); else echo "&nbsp;"; ?></td>
					<td width="87"><? if(count($products_id1)>4) echo showPic($products_id1[4],$products_column1[4],$products_title1[4],$products_pic_path1[4]); else echo "&nbsp;"; ?></td>
				</tr>
				<tr>
					<td width="87" height="87"><? if(count($products_id2)>0) echo showPic($products_id2[0],$products_column2[0],$products_title2[0],$products_pic_path2[0]); else echo "&nbsp;"; ?></td>
					<td width="87"><? if(count($products_id2)>1) echo showPic($products_id2[1],$products_column2[1],$products_title2[1],$products_pic_path2[1]); else echo "&nbsp;"; ?></td>
					<td width="87"><? if(count($products_id2)>2) echo showPic($products_id2[2],$products_column2[2],$products_title2[2],$products_pic_path2[2]); else echo "&nbsp;"; ?></td>
					<td width="87"><? if(count($products_id2)>3) echo showPic($products_id2[3],$products_column2[3],$products_title2[3],$products_pic_path2[3]); else echo "&nbsp;"; ?></td>
					<td width="87"><? if(count($products_id2)>4) echo showPic($products_id2[4],$products_column2[4],$products_title2[4],$products_pic_path2[4]); else echo "&nbsp;"; ?></td>
				</tr>
				<tr>
					<td width="87" height="87"><? if(count($products_id3)>0) echo showPic($products_id3[0],$products_column3[0],$products_title3[0],$products_pic_path3[0]); else echo "&nbsp;"; ?></td>
					<td width="87"><? if(count($products_id3)>1) echo showPic($products_id3[1],$products_column3[1],$products_title3[1],$products_pic_path3[1]); else echo "&nbsp;"; ?></td>
					<td width="87"><? if(count($products_id3)>2) echo showPic($products_id3[2],$products_column3[2],$products_title3[2],$products_pic_path3[2]); else echo "&nbsp;"; ?></td>
					<td width="87"><? if(count($products_id3)>3) echo showPic($products_id3[3],$products_column3[3],$products_title3[3],$products_pic_path3[3]); else echo "&nbsp;"; ?></td>
					<td width="87"><? if(count($products_id3)>4) echo showPic($products_id3[4],$products_column3[4],$products_title3[4],$products_pic_path3[4]); else echo "&nbsp;"; ?></td>
				</tr>
				<tr>
					<td width="87" height="87"><? if(count($products_id5)>0) echo showPic($products_id5[0],$products_column5[0],$products_title5[0],$products_pic_path5[0]); else echo "&nbsp;"; ?></td>
					<td width="87"><? if(count($products_id5)>1) echo showPic($products_id5[1],$products_column5[1],$products_title5[1],$products_pic_path5[1]); else echo "&nbsp;"; ?></td>
					<td width="87"><? if(count($products_id5)>2) echo showPic($products_id5[2],$products_column5[2],$products_title5[2],$products_pic_path5[2]); else echo "&nbsp;"; ?></td>
					<td width="87"><? if(count($products_id5)>3) echo showPic($products_id5[3],$products_column5[3],$products_title5[3],$products_pic_path5[3]); else echo "&nbsp;"; ?></td>
					<td width="87"><? if(count($products_id5)>4) echo showPic($products_id5[4],$products_column5[4],$products_title5[4],$products_pic_path5[4]); else echo "&nbsp;"; ?></td>
				</tr>
				<tr>
					<td width="87" height="87"><? if(count($products_id4)>0) echo showPic($products_id4[0],$products_column4[0],$products_title4[0],$products_pic_path4[0]); else echo "&nbsp;"; ?></td>
					<td width="87"><? if(count($products_id4)>1) echo showPic($products_id4[1],$products_column4[1],$products_title4[1],$products_pic_path4[1]); else echo "&nbsp;"; ?></td>
					<td width="87"><? if(count($products_id4)>2) echo showPic($products_id4[2],$products_column4[2],$products_title4[2],$products_pic_path4[2]); else echo "&nbsp;"; ?></td>
					<td width="87"><? if(count($products_id4)>3) echo showPic($products_id4[3],$products_column4[3],$products_title4[3],$products_pic_path4[3]); else echo "&nbsp;"; ?></td>
					<td width="87"><? if(count($products_id4)>4) echo showPic($products_id4[4],$products_column4[4],$products_title4[4],$products_pic_path4[4]); else echo "&nbsp;"; ?></td>
				</tr>
				
		</table>
	  </td>
	</tr>
</table>
</body>
</html>
